import service from "@/server/serviceIndex";

// 生成充值余额数据的未支付订单，并返回订单id
export const getPayOrderAPI = (token) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-permissions-order/getUploadBalanceNoPayOrder`,
        params: {
            token,
        },
    });
};

// 更新网店可添加商品余额信息
export const updateInfoPlAPI = (orderId) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-permissions-order/updateUploadBalanceInfo/${orderId}`,
    });
};

// 下单提高一个用户可绑定的实体店余额数
export const addShopSumAPI = (orderId) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-permissions-order/addShopSum/${orderId}`,
    });
};

/**
 * # Pi 充值支付流程
 */
// 处理充值未完成的订单
export const incomplete = (data) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-order-info/payOrder/incomplete`,
        data,
    });
};

// 生成pi币充值的未支付订单，并返回订单的id
export const getNoPidOrder = (params) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-order-info/getNoPidOrder?token=${params}`,
    });
};

// 前端请求支付授权,在本地订单创建后调
export const approve = (data) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-order-info/payOrder/approve`,
        data,
    });
};

// 前端支付完成,余额支付直接调用此方法
export const complete = (data) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-order-info/payOrder/complete`,
        data,
    });
};

// 取消支付,订单关闭
export const cancelled = (rechargeOrderId) => {
    return service({
        method: "post",
        url: `/pipayshopapi/recharge-order-info/payOrder/cancelled/${rechargeOrderId}`,
    });
};
//生成酒店未支付订单
export const generateUnpaidLiveOrderAPI = (token) => {
    return service({
        method: "post",
        url: `/pipayshopapi/shop-order/generateUnpaidLiveOrder`,
        params: {
            token,
        },
    });
};
//支付酒店下单接口
export const payLiveOrderAPI = (token) => {
    return service({
        method: "post",
        url: `/pipayshopapi/shop-order/payLiveOrder`,
        params: {
            token,
        },
    });
};
//获取网店额度
export const eshopLimitPrice = () => {
        return service({
            method: "GET",
            url: "/pipayshopapi/configuration/getEshopLimitPrice"
        })
    }
    //获取实体店额度
export const shopLimitPrice = () => {
    return service({
        method: "GET",
        url: "/pipayshopapi/configuration/getshopLimitPrice"
    })
}